Fix circular dependency in Performance Counters on Mac#44661
Merged
jeremydvoss merged 9 commits intoAzure:mainfrom Jan 15, 2026
Merged
Fix circular dependency in Performance Counters on Mac#44661jeremydvoss merged 9 commits intoAzure:mainfrom
jeremydvoss merged 9 commits intoAzure:mainfrom
Conversation
JacksonWeber
approved these changes
Jan 14, 2026
rads-1996
reviewed
Jan 14, 2026
lzchen
reviewed
Jan 14, 2026
...pentelemetry-exporter/azure/monitor/opentelemetry/exporter/_performance_counters/_manager.py
Show resolved
Hide resolved
lzchen
reviewed
Jan 14, 2026
sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a circular dependency issue in Performance Counters on Mac and other platforms where process I/O counters are unavailable. When _PerformanceCountersManager logged a warning about unavailable I/O counters, it triggered the _PerformanceCountersLogRecordProcessor, which in turn tried to access the not-yet-initialized singleton, causing an infinite lock.
Changes:
- Reordered pipeline setup to initialize metrics (with Performance Counters) before tracing and logging
- Removed non-actionable warning log for unavailable I/O counters on Mac/Linux
- Added test coverage to verify metrics setup occurs before logging and tracing setup
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| azure/monitor/opentelemetry/_configure.py | Moved metrics pipeline setup before tracing and logging to ensure Performance Counters are initialized before processors |
| azure/monitor/opentelemetry/exporter/_performance_counters/_manager.py | Removed non-actionable warning log for unavailable Process I/O Rate counter |
| tests/test_configure.py | Added test assertions to verify metrics setup order precedes logging and tracing |
| CHANGELOG.md | Documented bug fix with placeholder PR number |
sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry/tests/test_configure.py
Outdated
Show resolved
Hide resolved
…metry/_configure.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
lzchen
approved these changes
Jan 15, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Issue: langchain-ai/langchain-azure#234
On Mac, the I/O performance counter is not available. This was a known limitation, but the warning log it produced in _PerformanceCountersManager led to a circular dependency. As a log, it triggered the _PerformanceCountersLogRecordProcessor which in turn relied on _PerformanceCountersManager. This led to an infinite lock on the singleton.
To solve this, I moved the Metrics pipeline set up to before Logs and Tracing. This way, the Performance Counters are fully set up before the _PerformanceCountersLogRecordProcessor and _PerformanceCountersSpanProcessor are added. I also removed the log itself because it is not useful as a warning. If a customer is on a Mac or another OS that does not have process I/O, there is nothing for them to do. They will still be able to get all the other Performance Counters.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines